/*
 *  Copyright (C) 2010 takaji
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
 * StaticTextStep.java
 *
 * Created on Jan 24, 2010, 11:19:00 AM
 */
package examples.littlewizard;

import org.dakside.duck.dakwizard.AbstractWizardStep;
import javax.swing.Icon;

/**
 * A sample static step (does not require focus)
 * @author takaji
 */
public class StaticTextStep extends AbstractWizardStep<MyWizardModel> {

    /** Creates new form StaticTextStep */
    public StaticTextStep(MyWizardModel model, Icon image, String text) {
        super(model, false);
        initComponents();
        if (image == null) {
            jLabel1.setVisible(false);
        } else {
            jLabel1.setIcon(image);

        }
        txtStaticText.setText(text);

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        txtStaticText = new javax.swing.JLabel();

        jLabel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        txtStaticText.setText("jLabel2");
        txtStaticText.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtStaticText, javax.swing.GroupLayout.DEFAULT_SIZE, 224, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 177, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addComponent(txtStaticText, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel txtStaticText;
    // End of variables declaration//GEN-END:variables

    public boolean isCancellable() {
        return true;
    }

    public boolean isFinishable() {
        return getNextStep() == null;
    }

    @Override
    public boolean canGoNext() {
        return true;
    }

    @Override
    public boolean canGoBack() {
        return true;
    }
}
